<template>
  <div class="main">
    <div class="content">
      <div class="todoing">
        <h2>
          <span> 在行动 </span>
        </h2>
        <ul class="todoUl">
          <li v-for="item in this.data" :key="item._id">
            <div class="imgBox">
              <img :src="item.action_join.img" alt="" />
            </div>
            <div class="txtBox">
              <p>发起机构: {{ item.action_join.jg }}</p>
              <p>时间: {{ item.action_join.time }}</p>
              <p>地点: {{ item.action_join.address }}</p>
              <button class="look">查看详情</button>
            </div>
          </li>
        </ul>
      </div>

      <div class="myjoin">
        <h2>
          <span>我参与</span>
        </h2>
        <ul class="joinUl">
          <li v-for="item in data" :key="item._id" @click="toDetail(item._id)">
            <div class="bord">
              <div class="imgBox">
                <img :src="item.action_join.img" alt="" />
              </div>
            </div>
            <div class="txtBox">
              <p class="title">{{ item.action_join.title }}</p>
              <p class="jg">发起机构: {{ item.action_join.jg }}</p>
              <p class="time">时间: {{ item.action_join.time }}</p>
              <p class="address">地点: {{ item.action_join.address }}</p>

              <div class="joinBtn">我参与</div>
            </div>
          </li>
        </ul>
      </div>

      <div class="hot">
        <h2>
          <span>热点公益</span>
        </h2>
        <div>
          <div
            class="contentBox"
            v-for="item in data"
            :key="item.hot_recommend._id"
            @click="toDetail(item._id)"
          >
            <div class="hotTitle">
              {{ item.hot_recommend.title }}
            </div>
            <div class="ner">
              <div class="imgBox">
                <img :src="item.hot_recommend.img" alt="公益图片" />
              </div>
              <div class="txtBox" >
                <p>{{ item.hot_recommend.content }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  props: ["data"],
  mounted() {
    // console.log(this.data);
  },
  methods: {
    toDetail(id) {
      // console.log(event);
      // let id = event.target.id;
      this.$router.push(`/indexDetail/id=${id}`);
    },
  },
};
</script>
<style lang="scss" scoped>
.main {
  margin-top: 20px;
  .content {
    width: 1200px;
    margin: auto;

    .todoing {
      // border: 1px solid;
      margin-top: 50px;
      h2 {
        span {
          font-size: 26px;
          background: hsl(19, 100%, 58%);
          padding: 30px;
          color: white;
          // margin-left: 500px;
        }
        text-align: center;
        font-size: 20px;
        border-bottom: 3px solid hsl(19, 100%, 58%);
        padding: 9px 0;
      }
      .todoUl {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        margin-top: 100px;
        color: #555555;
        li {
          border: 2px solid #716457;
          border-radius: 5px;
          width: 24%;
          background: #f5f5f5;
          margin-bottom: 50px;
          // border: 1px solid;

          .imgBox {
            width: 100%;
            height: 400px;
            background: #000;
            overflow: hidden;
            img {
              transition: all 0.5s;
            }
            :hover {
              transform: scale(1.05);
            }
          }
          .txtBox {
            padding: 10px 0;
            padding-left: 30px;
            background: hsl(19, 100%, 58%);
            .look {
              margin-top: 10px;
              width: 100px;
              height: 35px;
              background: #91c03e;
              border: none;
              border-radius: 8px;
              outline: none;
              color: white;
            }
            p {
              margin-top: 10px;
              color: white;
            }
          }
        }
      }
    }

    .myjoin {
      // border: 1px solid;
      margin-top: 60px;
      h2 {
        span {
          font-size: 26px;
          background: hsl(19, 100%, 58%);
          padding: 30px;
          color: white;
          // margin-left: 500px;
        }
        font-size: 20px;
        text-align: center;
        border-bottom: 3px solid hsl(19, 100%, 58%);
        padding: 9px 0;
      }
      .joinUl {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        margin-top: 20px;
        // margin-left: 80px;

        li {
          width: 40%;
          height: 240px;
          // border: 1px solid;
          display: flex;
          align-items: center;

          margin-bottom: 30px;
          .bord {
            padding: 10px;
            border: 2px solid #716457;
            .imgBox {
              width: 200px;
              height: 140px;
              overflow: hidden;
              border: 1px solid #ccc;
              img {
                transition: all 0.5s;
              }
              :hover {
                transform: scale(1.05);
              }
            }
          }
          .txtBox {
            width: 300px;
            // border: 1px solid;
            margin-left: 20px;
            height: 100%;
            position: relative;
            padding-top: 50px;
            p {
              margin-bottom: 10px;
              color: #716457;
            }
            .title {
              font-weight: bold;
              margin-top: 20px;
              font-size: 20px;
              color: #716457;
            }
            .joinBtn {
              width: 412px;
              height: 40px;
              margin-bottom: -20px;
              margin-left: -268px;
              line-height: 40px;
              text-align: center;
              color: #fff;
              background-color: #91c03e;
              position: absolute;
              bottom: 22px;
              left: 22px;
              font-size: 18px;
              cursor: pointer;
              opacity: 0.8;
            }
            :hover {
              opacity: 1;
            }
          }
        }
      }
    }
    .hot {
      margin-top: 90px;
      h2 {
        span {
          font-size: 26px;
          background: hsl(19, 100%, 58%);
          padding: 30px;
          color: white;
        }
        text-align: center;
        font-size: 20px;
        border-bottom: 3px solid hsl(19, 100%, 58%);
        padding: 9px 0;
      }
      div {
        .contentBox {
          display: flex;
          flex-direction: column;
          width: 490px;
          // height: 300px;
          margin: 20px;
          overflow: hidden;
          .hotTitle {
            margin: 50px auto;
            background: hsl(19, 100%, 58%);
          }
          .ner {
            display: flex;
            justify-content: space-between;
            .imgBox {
              img {
                width: 250px;
              }
            }
            .txtBox {
              text-overflow: ellipsis;
              word-break: break-all;
              width: 220px;
              display: -webkit-box;
              -webkit-box-orient: vertical;
              -webkit-line-clamp: 8;
              overflow: hidden;
            }
          }
        }
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
      }
    }
  }
}
</style>